# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=simgear
pkgver=2019.1.1
pkgrel=2
pkgdesc="Sim library for FlightGear"
options="!check" # Accepts boost only up to 1.71.0
url="https://github.com/FlightGear/simgear"
arch="x86_64" # openscenegraph availability
license="GPL"
makedepends="$depends_dev boost-dev cmake curl-dev mesa-dev openal-soft-dev
	openscenegraph-dev zlib-dev expat-dev"
subpackages="$pkgname-dev"
source="https://downloads.sourceforge.net/project/flightgear/release-${pkgver%.[0-9]}/simgear-$pkgver.tar.bz2
	musl-fixes.patch
	https://github.com/FlightGear/simgear/commit/d883ab278d10c89580d5bbc4473d2e9fc375b7b9.patch
	https://github.com/FlightGear/simgear/commit/b28f030874d514dfc1393f5a7156f202556f3730.patch
	https://github.com/FlightGear/simgear/commit/dc886118baec64f9e86e45c1e2713bbf245f972e.patch
	"

build() {
	# use system expat
	rm -rf simgear/xml/*.h simgear/xml/*.c

	cmake \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DSYSTEM_EXPAT=ON \
		-DENABLE_TESTS=false \
		.
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="83fe4330cf27b9298719f53f2fccde2af77bacdc6f430cc22c8bdfb475fe9b6e01578c1225af21e4e1433c7d2f2b00427454064f942359ba4c1e9896e7fe05d2  simgear-2019.1.1.tar.bz2
7efcf01c9328b0732ae9aa7af4edb52e14919663a8d3acbe429a0697f59a55e85a71628d9afaa3d38327d960dbf5dacc1f964e38dd6cb499b593ae2be918b140  musl-fixes.patch
db2e5a38ff985ac9d81af6d623a92bd1791d002b8629a810eb7873d5b743e6a51f5c841d3ba5207f95d6edcf3fe2565ec521f9d86ef6eb1f4a5c61dc90de5bdb  d883ab278d10c89580d5bbc4473d2e9fc375b7b9.patch
54b40b272b6847c6bd1c74d2758b15c239870c590daa6fdeb6eb402e220a0606a06f7f9e5abfebc3d8856d79e6921c0ec641cae148bac3efb0972150b7323f3d  b28f030874d514dfc1393f5a7156f202556f3730.patch
d03427c942b377d147529fb29f71e307543dd19946ef21868629d20c1e7205a122bebf8d7d54c4914e6b1765eceab207e433501db4665f6657d18e56a7bf80ea  dc886118baec64f9e86e45c1e2713bbf245f972e.patch"
